import { createRouter, createWebHistory } from 'vue-router'
import home from '../views/home.vue'
import cycleRate from '../views/cycle.vue'
import jSwitch from '../views/switch.vue'
import test from '../views/test.vue'

const routes = [
	{
		path: '/cycleRate',
		name: 'cycleRate',
		component: cycleRate,
	},
	{
		path: '/switch',
		name: 'switch',
		component: jSwitch,
	},
]

const router = createRouter({
	history: createWebHistory(process.env.BASE_URL),
	routes,
})

// router.beforeEach((to, form, next) => {
// 	// 路由守卫  用来控制登录权限
// 	if (to.meta.keepAlive) {
// 		if (store.state.user.isLogin) {
// 			next()
// 		} else {
// 			next({ name: 'login' })
// 		}
// 	} else {
// 		next()
// 	}
// })

export default router
